---
import { Code } from '@astrojs/starlight/components';

const code = `
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class CounterPage extends StatelessWidget {
  const CounterPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        BlocBuilder<CounterBloc, int>(
          builder: (context, state) => Text('Count: \$state'),
        ),
        ElevatedButton(
          onPressed: () {
            BlocProvider.of<CounterBloc>(context).add(CounterIncrement());
          },
          child: const Text('Increment'),
        ),
      ],
    );
  }
}
`;
---

<Code code={code} lang="dart" title="counter_page.dart" />
